 <?

// iDeal whooo
function Display_iDeal_Option()
{
  $Output ='';
  $Output =$Output.'<table width="475" border="0" align="center">
  <tr>
    <td colspan="2"><FORM ACTION="MakePayment.php" METHOD="post">
      <div align="center">
	  <table width="95%" border="1" align="center">
        <tr> 
          <td><div align="center"><span class="RedBold">iDeal</span></div></td>
        </tr>
        <tr><td><div align="center">
		  <span class="WhiteBold">Vertrouwd via uw eigen bank online betalen. </span>
		  <br><br><input type="submit" name="Submit" value="Klik hier om te betalen via iDeal"><br><br>
        </div></td>
      </tr>
      </table>
	  <INPUT TYPE="hidden" NAME="PayType" VALUE="iDeal">
      </div>
      </FORM> 
    </td>
  </tr>
  <tr bgcolor="#666666"> 
    <td colspan="2">&nbsp;</td>
  </tr>
</table>';
  return $Output;
}

// Knop om naar iDeal te gaan
function Create_iDeal_Info($Arr_MoneyOrder,$Site_Title,$Site_Domain,$Session_Prefix,$Currency_Symbol,$Currency_Code)
{
  $CartTotals=GetCartTotals($Session_Prefix);
  $MoneyOrderTotal=$CartTotals['Order_Total']+1;
  
	$sOrderId = rand(1000000, 9999999); // Uniek order ID
	$sOrderDescription = 'TROEP'; // Omschrijving
	$fOrderAmount = $MoneyOrderTotal; // Bedrag (decimaal)
	
	if(function_exists('date_default_timezone_set'))
	{
		date_default_timezone_set('Europe/Amsterdam');
	}

	include(dirname(__FILE__) . '/library/ideallite.cls.php');

	//Deze drie regels zijn om via de POST method waardes mee te geven, doen we nu dus niet
	
	//$sOrderId = (empty($_POST['order_id']) ? '' : $_POST['order_id']);
	//$sOrderDescription = (empty($_POST['order_description']) ? '' : $_POST['order_description']); // Upto 32 characters
	//$fOrderAmount = floatval(empty($_POST['order_amount']) ? '' : str_replace(',', '.', $_POST['order_amount'])); 

	$oIdeal = new IdealLite();

	$sCurrentUrl = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['SERVER_NAME'] . '/') . substr($_SERVER['SCRIPT_NAME'], 1);
	$sReturnUrl = substr($sCurrentUrl, 0, strrpos($sCurrentUrl, '/') + 1) . '/inc/payment_mods/ideal_afronding.php';

	$oIdeal->setUrlCancel($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=cancel');
	$oIdeal->setUrlError($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=error');
	$oIdeal->setUrlSuccess($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=success');
	$oIdeal->setAmount($fOrderAmount);
	$oIdeal->setOrderId($sOrderId);
	$oIdeal->setOrderDescription($sOrderDescription);

	$oIdeal->setButton('Betalen met iDEAL');
  
  $Output ='';
  $Output =$Output.'<div align="center">
<b>'.$Site_Title.' iDeal betaling</b><br />
<b>Klik op de knop hieronder om naar de beveiligde iDeal omgeving te gaan</b><br /><br />'
.$oIdeal->createForm()
."<br/><br/>".DisplayCartWShipping($Session_Prefix,$Currency_Symbol,$Currency_Code)."<br/><br/>
 + (".$Currency_Code.")".$Currency_Symbol." 1.00 iDeal kosten<br/><br/>

<b>Zodra het geld binnen is gaan we het opmaken aan bier!<br/>
Bedankt voor shoppen @ ".$Site_Title.".</b><br/>
".$Site_Domain."<br/><br/>
- Automatisch gegenereerd, niet opslaan in uw favorieten - </div>"; 
  return $Output;
}
?>